package CMPF_FLOAT;

public class Example {
    /**
     * Calculates define integral
     */
    public static double integral(MyFunction f, double x1,
                                  double x2) {
        double x = x1;
        double result = 0;
        double step = (x2 - x1) / 700;
        while (x != x2) { // should use (x <= x2)
            result = result + f.valueFor(x) * step;
            x = x + step;
        }
        return result;
    }
}
